<template>
	<div style="margin-bottom: 20px;">
		<el-table
			border
			size="mini"
			class="small-size-table"
			:data="tableData"
			style="width: 100%"
			:header-cell-style="getRowClass"
			highlight-current-row
		>
			<el-table-column
				align="center"
				:label="`${$t('report.project')}`"
				prop="venueName"
				min-width="180px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{ scope.row.venueName || '-' }}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="rebateAmountTitle"
				prop="rebateAmount"
				min-width="180px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(scope.row.currency, scope.row.rebateAmount)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="rebateAmountTitleRate"
				prop="rebateRate"
				min-width="180px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{ handlePercentage(scope.row.rebateRate) }}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="validBetAmountTitle"
				prop="validBetAmount"
				min-width="180px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					<div
						v-if="isTexas"
						class="blueColor decoration"
						style="cursor: pointer;"
						@click="showDetails"
					>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.serviceAmountContribution
							)
						}}
					</div>
					<template v-else>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.validBetAmount
							)
						}}
					</template>
				</template>
			</el-table-column>
		</el-table>
		<ServiceChargeDetail
			from="proxy"
			module="funds"
			:dialog="dialog"
			kind="team"
			:tableData="tableData"
			:handleClose="handleClose"
		/>
	</div>
</template>

<script>
import list from '@/mixins/list'
import ServiceChargeDetail from '@/components/Dialog/ServiceChargeDetail'

export default {
	mixins: [list],
	components: {
		ServiceChargeDetail
	},
	props: {
		isTexas: {
			type: Boolean,
			default: false
		},
		isInsure: {
			type: Boolean,
			default: false
		},
		tableData: {
			type: Array,
			default: () => {}
		}
	},
	data() {
		return {
			dialog: false
		}
	},
	computed: {
		rebateAmountTitle() {
			if (this.isInsure) {
				return '团队分成'
			} else {
				return this.$t(
					'funds.proxy_member_funds_record.rebate_amount_point'
				)
			}
		},
		rebateAmountTitleRate() {
			if (this.isInsure) {
				return '团队分成比例'
			} else {
				return this.$t('funds.fund_audit.team_rebate_proportion')
			}
		},
		validBetAmountTitle() {
			if (this.isTexas) {
				return this.$t('common.service_charge_contribute_team')
			} else if (this.isInsure) {
				return this.$t('funds.fund_audit.total_pure_amount')
			} else {
				return this.$t('funds.fund_audit.team_valid_bet')
			}
		},
		textInfo() {
			let flag = ''
			if (this.kind === 'team') flag = '_team'
			return getText(flag)
		}
	},
	methods: {
		showDetails() {
			this.dialog = true
		},
		handleClose() {
			this.dialog = false
		}
	}
}
</script>
